<?php
/**
 * 用于得到相关的SQL语句
 */

class DbTemplate {

	private $total;
	private $config;

	/**
	 * 构造器
	 */
	public function __construct() {
		// do nothing.
	}

    /**
     * 获得SQL语句
     *
     * @param array $input_ary
     */
    public function sql(&$ops, &$data) {

        $this->db_table = $ops['db_table'];

        foreach($data as $key => $value) {

			$this->$key = $value;
		}

        $sql = $ops['sql']['sql'];
		if ($sql && is_array($sql)) {
			foreach($sql as $key => $value) {
				try {
					eval("\$sql[\$key] = \"$sql[$key]\";");
				}
				catch (Exception $e) {
					throw_exception('执行eval时发生错误，eval的sql是：'.$value);
				}
			}
		}
		return $sql;
    }
}
?>